package com.cloudbroker.bcs.platform.dav.common.controller;

import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.stock.result.StockDetailResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.stock.result.StockListResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.viewpoint.vo.StockCodeForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.viewpoint.vo.StockListForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.common.StockT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

/**
 * Created by zhaojp18008 on 2016/5/11.
 */
@Controller
public class StockController {
    @Resource
    private StockT2BizService stockT2;
    /**
     * 查询大V标签
     * */
    @ResponseBody
    @RequestMapping("/func_stock_list")
    @SaveLog(remark = "全市场股票代码列表")
    public StockListResult funcStockList(HttpServletRequest request , String jsonpcallback){
        StockListForm form = getSingleParameterMapForBody(request , StockListForm.class);
        return VOUtil.setJsonpResult(stockT2.funcStockList(form), jsonpcallback);
    }
    /**
     * 股票代码信息查询
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/func_stock_info_qry")
    @SaveLog(remark = "股票代码信息查询")
    public StockDetailResult checkStockCode(HttpServletRequest request, String jsonpcallback) {
        StockCodeForm form = getSingleParameterMapForBody(request, StockCodeForm.class);
        return VOUtil.setJsonpResult(stockT2.checkStockCode(form), jsonpcallback);
    }
}
